
let http =require("http")
let port =4000
let hostname = "0.0.0.0"
// import word from './one'
const word = require('./one')
const {arr,list}=require('./utils')
const {names}=require('./utils')
const User=require("./User")
const Student = require("./Student")
const s1=new Student('xiaoming',26,'wh2114',95)

const u1=new User('zuozuomu',28,'wh2114daydayup')

const server=http.createServer((req,res)=>{
    console.log(req.url)
    if(req.url!='/favicon.ico'){
        res.writeHead(200,{'content-Type':'text/html;charset=utf8'})
        res.write("<h2>CommomJS 模块化</h2>")
        res.write("<h2>模块化  把复杂的代码拆分为可复用简单独立的代码模块</h2>")
        res.write("<h2>模块化 模块定义 模块暴露 模块引入</h2>")
        res.write( `<h2>${word}</h2>`)
        res.write( `<h2>${arr}</h2>`)
        res.write( `<h2>${list}</h2>`)
        res.write( `<h2>${names}</h2>`)
        res.write( `<h2>${u1.name}--${u1.age}--${User.hobby}--${u1.say()}</h2>`)
        res.write( `<h2>${s1.name}--${s1.age}--${Student.hobby}--${s1.say()}</h2>`)
        res.end()
    }
})



server.listen(port,hostname,()=>{
    console.log(`this server is running at http://${hostname}:${port}`)
})